# from flask import  Blueprint,request,redirect,session,abort
# bp = Blueprint('task_manage_bp',__name__,url_prefix='/task_manage')
# from blueprint.task_manage_bp_impl import *
# from utils.decorator import *
#
# # 用户编辑任务功能中：部门的下拉框
# @bp.route('/get_project')
# @json_response
# def get_project():
#     try:
#         login_name = session['login_name']
#         if login_name == None or login_name == '':
#             return dict(success=False, msg='用户登陆状态有误', code=301)
#     except Exception as err:
#         return dict(success=False, msg='用户登陆状态有误', code=301)
#     try:
#         res = get_department_impl(login_name)
#     except Exception as err:
#         return dict(success=False, msg='查询项目组信息出错', code=800)
#     return dict(success=True, data=res)
#
# # 用户编辑任务功能中：提交新编辑的任务项
# @bp.route('/add_task',methods=['POST'])
# @json_response
# def add_task():
#     try:
#         # POST请求数据获取方式：get_data()得到byte类型数据，decode成utf8编码格式的str，再用eval函数转成字典
#         data = request.get_data().decode('utf-8')
#         json_data = eval(data)
#         title = json_data['title']
#         content = json_data['content']
#         project = json_data['project']
#         remark = json_data['remark']
#         status = json_data['status']
#     except Exception as err:
#         return dict(success=False, msg='传入数据有误', code=150)
#     try:
#         author = session['login_name']
#         print(author)
#     except Exception as err:
#         return dict(success=False, msg='用户登陆状态有误', code=301)
#         # author = "aaa"
#     try:
#         add_task_impl(title, author, content, project, remark, status)
#         return dict(success=True, data='OK')
#     except Exception as err:
#         return dict(success=False, msg='新增任务事项出错', code=800)
#
# # 查询和此登陆用户有关的所有事项
# @bp.route('/read_task')
# def read_task():
#     try:
#         author = session['login_name']
#     except Exception as err:
#         return dict(success=False, msg='用户登陆状态有误', code=301)
#     try:
#         res = read_task_impl(author)
#         return dict(success=True, data=res)
#     except Exception as err:
#         return dict(success=False, msg='查询相关信息出错', code=800)
#
# # 编辑原有的任务项（修改进度完成情况等）
# @bp.route('/modify_task',methods=['POST'])
# def modify_task():
#     try:
#         # POST请求数据获取方式：get_data()得到byte类型数据，decode成utf8编码格式的str，再用eval函数转成字典
#         data = request.get_data().decode('utf-8')
#         json_data = eval(data)
#         item_id = json_data['item_id']
#         title = json_data['title']
#         content = json_data['content']
#         project = json_data['project']
#         remark = json_data['remark']
#         status = json_data['status']
#     except Exception as err:
#         return dict(success=False, msg='传入数据有误', code=150)
#     try:
#         author = session['login_name']
#     except Exception as err:
#         return dict(success=False, msg='用户登陆状态有误', code=301)
#         # author = "aaa"
#     try:
#         modify_task_impl(item_id,title, author, content, project, remark, status)
#         return dict(success=True, data='OK')
#     except Exception as err:
#         return dict(success=False, msg='新增任务事项出错', code=800)
